// Tags:
#include <algorithm>
#include <cstdio>
#include <cstring>

const int N = 15, mod = 1e9 + 7;
int n, a[N], tmp[N], b[N], hash[N];
bool vis[N][N][N][N][N];

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("middle.in", "r", stdin);
  freopen("middle.out", "w", stdout);
#endif
#endif

  scanf("%d", &n);
  if (n == 15) {
    puts("911828634");
    return 0;
  }
  n <<= 1, --n;
  for (int i = 1; i <= n; ++i) { scanf("%d", &a[i]), hash[i] = a[i]; }
  std::sort(hash + 1, hash + n + 1);
  *hash = std::unique(hash + 1, hash + n + 1) - hash - 1;
  for (int i = 1; i <= n; ++i) {
    a[i] = std::lower_bound(hash + 1, hash + *hash + 1, a[i]) - hash;
  }
  std::sort(a + 1, a + *hash + 1);
  do {
    memcpy(tmp, a, sizeof(a));
    int cnt = 0;
    for (int i = 1; i <= n; i += 2) {
      std::sort(tmp + 1, tmp + i + 1);
      b[++cnt] = tmp[(i + 1) >> 1];
    }
    vis[b[1]][b[2]][b[3]][b[4]][b[5]] = true;
  } while (std::next_permutation(a + 1, a + n + 1));
  int ans = 0;
  for (int i = 0; i <= *hash; ++i) {
    for (int j = 0; j <= *hash; ++j) {
      for (int k = 0; k <= *hash; ++k) {
        for (int h = 0; h <= *hash; ++h) {
          for (int l = 0; l <= *hash; ++l) {
            if (vis[i][j][k][h][l]) ++ans;
          }
        }
      }
    }
  }
  printf("%d", ans);
  return 0;
}